package com.itheima.controller;

import com.itheima.pojo.Pagebean;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmpController {
    @Autowired
    private EmpService empService;

    @GetMapping("/emps")
    public Result page(@RequestParam (defaultValue = "1") Integer currentPage,
                       @RequestParam (defaultValue = "10") Integer pageSize){
          Pagebean pagebean = empService.page(currentPage,pageSize);
          return Result.success(pagebean);
    }
}